<template>
  <div id="contain">
<!--    route测试-->
<!--    <div><span>我是route.name{{$route.name}}</span></div>-->
    <h1 class="title" align="center">待审核用户</h1>
    <el-table
        @row-click="openAuditPage"
        :header-cell-style="{
          color: '#666',
          fontFamily: 'Arial',
          fontSize:'23px',
          highlighted:'true'
        }"
        :cell-style="{
          cursor: 'pointer'
        }"
        :data="tableDate"
        height="800"
        border
        style="width: 100%">
      <el-table-column
          prop="userAccount"
          label="用户"
          align="right"
          width="300">
      </el-table-column>
      <el-table-column
          prop="constructDate"
          label="时间"
          width="450">
      </el-table-column>>
    </el-table>
  </div>
</template>

<script>

export default {
  name: "AuditAll",
  data() {
    // console.log(this)
    return {
      tableDate:[{userAccount:'123',constructDate:"123"}],
    }
  },
  methods:{
    getTableData(){
      this.$axios.get(`/Test/auditor/listUsers.do`).then((response)=>{
        console.log('这是返回的response',response)
        this.tableDate = response.data
      }).catch((error)=>{
        alert('失败')
        console.log(error)
      })
    },
    openAuditPage(rowIndex){
      //通过rowIndex来搞清楚哪一行被点击了，rowIndex.id就是改行的行号
      console.log(rowIndex);
      //定位数据
      const that=this
      // router能带参数跳转测试
      // this.$router.push({name:'AuditSingleUser',params:{account:this.tableDate[rowIndex.id-1].title}})
      // router使用
      that.$router.push({name:'AuditSingleUser',params:{userAccount:rowIndex.userAccount}})
    },
  },
  mounted() {
    this.getTableData()
  },
}
</script>

<style scoped>

</style>